<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page pageEncoding="UTF-8" %>
<!DOCTYPE HTML>
<html>
<head>
    <title>Edit dish</title>
    <meta charset="UTF-8"/>
    <LINK REL=StyleSheet HREF="admin-style.css" TYPE="text/css"/>
</head>
<body>
<section class="round" id="container">
    <div id="header">
        <a href='admin.html'>
            <img id="logo" src="logo.jpg"/>
        </a>
    </div>
    <form action="editDish" method="POST" accept-charset="iso-8859-1" enctype="multipart/form-data">
        <table>
            <tr>
                <td><input type="hidden" name="id" value="${requestScope.dish.id}"/></td>
            </tr>
            <tr>
                <td>Название</td>
                <td><input type="text" name="name" value="${requestScope.dish.name}"/></td>
            </tr>
            <tr>
                <td>Описание</td>
                <td><input type="text" name="description" value="${requestScope.dish.description}"/></td>
            </tr>
            <tr>
                <td>Стоимость</td>
                <td><input type="text" name="price" value="${requestScope.dish.price}"/></td>
            </tr>
            <tr>
                <td>Раздел меню</td>
                <td>
                    <select name="tagId">
                        <c:forEach var="tag" items="${requestScope.tags}">
                            <c:choose>
                                <c:when test="${requestScope.dish.tagId == tag.id}">
                                    <option value="${tag.id}" selected>${tag.name}</option>
                                </c:when>
                                <c:otherwise>
                                    <option value="${tag.id}">${tag.name}</option>
                                </c:otherwise>
                            </c:choose>
                        </c:forEach>
                    </select>
                </td>
            </tr>
            <tr>
                <td>Доступность</td>
                <td>
                    <select name="available">
                        <c:choose>
                            <c:when test="${requestScope.dish.available}">
                                <option value="true" selected>Доступно</option>
                                <option value="false">Недоступно</option>
                            </c:when>
                            <c:otherwise>
                                <option value="true">Доступно</option>
                                <option value="false" selected>Недоступно</option>
                            </c:otherwise>
                        </c:choose>
                    </select>
                </td>
            </tr>
            <tr>
                <td>Изображение</td>
                <td><input type="text" name="image" value="${requestScope.dish.image}"/></td>
            </tr>
            <tr>
                <td><input type="submit" name="delete" value="Удалить"/></td>
                <td><input type="submit" name="save" value="Сохранить"/></td>
            </tr>
        </table>
    </form>
</section>
</body>
</html>
